// 引入 request 文件
import request from '@/utils/request'

// 以下 api 为博主项目示例，实际与项目相匹配
// 微信登录
export const wxlogin = (params) => {
    return request({
        url: '/wxapi/wxlogin',
        method: 'post',
        data: params
    })
}

// 轮播图
export const getImgList = () => {
    return request({
        url: '/shop/img/list',
        method: 'get'
    })
}

// 商品分类列表
export const tzCatelist = (data) => {
    return request({
        url: '/shop/category/tzCatelist',
        method: 'get',
		data:data
    })
}

// 商品详情列表
export const prodlist = (data) => {
    return request({
        url: '/shop/prod/prodlist',
        method: 'get',
		data:data
    })
}

// 商品规格列表
export const skulist = (data) => {
    return request({
        url: '/shop/sku/skulist',
        method: 'get',
		data:data
    })
}

// 商品评价列表
export const prodCommlist = (data) => {
    return request({
        url: '/shop/comm/prodCommlist',
        method: 'get',
		data:data
    })
}

// 加入购物车
export const postBasket = (data) => {
    return request({
        url: '/shop/basket/addTzBasket',
        method: 'post',
        data: data
    })
}

// 购物车列表
export const basketAlllist = (data) => {
    return request({
        url: '/shop/basket/basketAllList',
        method: 'get',
		data:data
    })
}

// 购物车删除
export const removeById= (id) => {
    return request({
        url: '/shop/basket/removeById/'+id,
        method: 'get',
    })
}

// 新增收货地址
export const addAddr = (data) => {
    return request({
        url: '/shop/addr/addAddr',
        method: 'post',
        data: data
    })
}

// 修改收货地址
export const updateAddr = (data) => {
    return request({
        url: '/shop/addr/updateAddr',
        method: 'post',
		data:data
    })
}

// 查询收货地址
export const selectByUserId = (data) => {
    return request({
        url: '/shop/addr/selectByUserId',
        method: 'get',
		data:data
    })
}

// 生成订单
export const orderSubmit = (data) => {
    return request({
        url: '/shop/order/submit',
        method: 'post',
		data:data
    })
}

// 微信支付
export const payment = (data) => {
    return request({
        url: '/shop/order/payment',
        method: 'post',
		data:data
    })
}

// 查询订单
export const orderlist = (data) => {
    return request({
        url: '/shop/order/orderlist',
        method: 'get',
		data:data
    })
}

// 新增收藏
export const addFv = (data) => {
    return request({
        url: '/shop/favorite/addFv',
        method: 'post',
		data:data
    })
}

// 删除收藏
export const removeFav = (data) => {
    return request({
        url: '/shop/favorite/removeFav/'+data.prodId,
        method: 'delete',
    })
}

// 查询收藏
export const prodFavList = (data) => {
    return request({
        url: '/shop/favorite/prodFavList',
        method: 'get',
		data:data
    })
}

// 修改个人信息
export const saveUserInfo = (data) => {
    return request({
        url: '/wxapi/saveUserInfo',
        method: 'post',
		data:data
    })
}

// 猜你喜欢
export const favProdlist = () => {
    return request({
        url: '/shop/prod/favProdlist',
        method: 'get'
    })
}

// 区域三级联动
export const treeList = () => {
    return request({
        url: '/shop/area/AreaTypelist',
        method: 'get'
    })
}



